home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™94 / Miscellaneous / Randy Thelen / ThreadedSort / Misc Stuff / Synchronization.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-26  |  568 b   |  38 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Synchronization.h
  3.  
  4.     Contains:    Some classes useful for synchronizing multiple threads or tasks.
  5.  
  6.     Written by: Dave Falkenburg
  7.  
  8.     Copyright:    © 1993 by Dave Falkenburg, all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.      
  12.  */
  13.  
  14. #ifndef        _SYNCHRONIZATION_
  15. #define        _SYNCHRONIZATION_
  16.  
  17. #ifndef        __THREADS__
  18. #include     <Threads.h>
  19. #endif
  20.  
  21.  
  22. class    TSimpleSemaphore
  23.     {
  24. private:
  25.     long            fCounter;
  26.     ThreadID        fOwner;
  27.     TList            fWaitingList;
  28.     
  29. public:
  30.                 TSimpleSemaphore(void);
  31.                 ~TSimpleSemaphore(void);
  32.     
  33.     OSErr        Wait(void);
  34.     OSErr        Signal(void);
  35.     };
  36.  
  37. #endif
  38.